package it.uniroma2.structure;

import java.util.Vector;

public class VariableWhile extends Variable {
	private Vector<Parameter> associatedParameter;
	private String messageType;
	private Service service;
	
	public VariableWhile(String name, Parameter p) {
		super(name);
		this.setAssociatedParameter(p);
	}
	
	
	public VariableWhile(String name, String messageType, Parameter p) {
		super(name);
		this.setMessageType(messageType);
		this.setAssociatedParameter(p);
	}
	
	
	public VariableWhile(String nameVar, String msgtype, Parameter tempPI, Service serviceNode) {
		this(nameVar, msgtype, tempPI);
		this.service = serviceNode;
	}


	@Override
	public boolean equals(Object obj) {
		return (((Variable)obj).getName().equals(this.getName()));
	}
	
	
	public Vector<Parameter> getAssociatedParameter() {
		return associatedParameter;
	}
	
	
	public void setAssociatedParameter(Parameter associatedParameter) {
		this.associatedParameter.addElement(associatedParameter);
	}
	
	
	@Override
	public String toString() {
		return super.toString() + " messageType=\"" + messageType + "\"";
	}
	
	
	@Override
	public String toBPEL() {
		return "<" + super.variableTag + " " + this.toString() + "/>\n";
	}
	
	
	public String getMessageType() {
		return messageType;
	}
	
	
	public void setMessageType(String messageType) {
		this.messageType = messageType;
	}
}
